var timer = {
	dealWithTime(data) {
		// data = new Date(data);
		let formatDateTime
		let Y = data.getFullYear()
		let M = data.getMonth() + 1
		let D = data.getDate()
		let H = data.getHours()
		let Min = data.getMinutes()
		let S = data.getSeconds()
		let W = data.getDay()
		H = H < 10 ? ('0' + H) : H
		Min = Min < 10 ? ('0' + Min) : Min
		S = S < 10 ? ('0' + S) : S
		M = M < 10 ? ('0' + M) : M
		D = D < 10 ? ('0' + D) : D
		formatDateTime = Y + '-' + M + '-' + D + ' ' + H + ':' + Min + ':' + S
		return formatDateTime
	},
	dealWithDay(data) {
		data = new Date(data);
		let formatDateTime
		let Y = data.getFullYear()
		let M = data.getMonth() + 1
		let D = data.getDate()
		M = M < 10 ? ('0' + M) : M
		D = D < 10 ? ('0' + D) : D
		formatDateTime = Y + '-' + M + '-' + D
		return formatDateTime
	},
	myTime(date) {
		var arr = date.split("T");
		var d = arr[0];
		var darr = d.split('-');

		var t = arr[1];
		var tarr = t.split('.000');
		var marr = tarr[0].split(':');
		
		var dd = parseInt(darr[0]) + "-" + timer.addZero(parseInt(darr[1])) + "-" + timer.addZero(parseInt(darr[2])) + " " + timer.addZero(parseInt(marr[0])) + ":" +
			timer.addZero(parseInt(marr[1])) + ":" + timer.addZero(parseInt(marr[2]));
		return dd;
	},
	addZero(num) {
	    return num < 10 ? '0' + num : num;
	},
	unique(arr,orderName) { // 根据唯一标识orderId来对数组进行过滤
		const res = new Map(); //定义常量 res,值为一个Map对象实例
		//返回arr数组过滤后的结果，结果为一个数组   过滤条件是，如果res中没有某个键，就设置这个键的值为1
		return arr.filter((arr) => !res.has(arr[orderName]) && res.set(arr[orderName], 1))
	}
}

var pdaAnimation = {
	Toggle(anmiaton,that) {
		that.animation= anmiaton;
		setTimeout(()=>{
			that.animation= -1;
		}, 1000)
	},
}

export default {
	timer,
	pdaAnimation
}
